package com.axjy.service.impl;

import com.axjy.mapper.PoleInfoMapper;
import com.axjy.pojo.PoleInfo;
import com.axjy.service.PoleInfoService;
import com.axjy.service.vo.Pager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by l on 2018/1/30.
 */
@Service("poleService")
@Transactional
public class PoleInfoServiceImpl implements PoleInfoService {

    @Resource
    private PoleInfoMapper poleInfoMapper;

    @Override
    public PoleInfo selectByPrimaryKey(Integer key) {
        return poleInfoMapper.selectByPrimaryKey(key);
    }

    @Override
    public Pager search(Integer offset, Integer limit, String lineCode, Integer isStart) {
        Pager pager=new Pager();
        pager.setRows(poleInfoMapper.search(offset,limit,lineCode,isStart));
        pager.setTotal(poleInfoMapper.searchTotal(lineCode,isStart));
        return pager;
    }

    @Override
    public List<PoleInfo> searchAll() {
        return poleInfoMapper.selectAll();
    }

    @Override
    public List<PoleInfo> startPole() {
        return poleInfoMapper.startPole();
    }

    @Override
    public void addPole(PoleInfo pole) {
        poleInfoMapper.addPole(pole);
    }

    @Override
    public void delPole(Map<String, Object> params) {
            poleInfoMapper.del(params);
    }

    @Override
    public void updateStart(String lineCode, Integer isStart) {
        poleInfoMapper.updateStart(lineCode,isStart);
    }

    @Override
    public void emptyDate(String lineCode) {
        poleInfoMapper.emptyDate(lineCode);
    }

    @Override
    public List<PoleInfo> detail(String lineCode) {
        return poleInfoMapper.detail(lineCode);
    }

    @Override
    public void updateStatusId(Integer isStart, Integer id) {
        poleInfoMapper.updateStatusId(isStart, id);
    }

    @Override
    public void update(PoleInfo poleInfo) {
        poleInfoMapper.update(poleInfo);
    }
}
